package com.qiang.test03;

import java.io.IOException;
import java.net.*;

public class ServerDemo {
    public static void main(String[] args) throws IOException {
        MulticastSocket ds = new MulticastSocket(10000);

        byte[] bb = new byte[1024];
        DatagramPacket dp = new DatagramPacket(bb, bb.length);
        ds.joinGroup(InetAddress.getByName("224.0.1.0"));
        ds.receive(dp);
        byte[] data = dp.getData();
        int length = dp.getLength();
        System.out.println(new String(data,0,length));
        ds.close();
    }
}
